package com.hanthink.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hanthink.common.annotation.Log;
import com.hanthink.common.core.controller.BaseController;
import com.hanthink.common.core.domain.AjaxResult;
import com.hanthink.common.enums.BusinessType;
import com.hanthink.system.domain.EmployeeWechat;
import com.hanthink.system.service.IEmployeeWechatService;
import com.hanthink.common.utils.poi.ExcelUtil;
import com.hanthink.common.core.page.TableDataInfo;

/**
 * 月度推送企业微信人员管理Controller
 * 
 * @author lizhao
 * @date 2022-08-26
 */
@RestController
@RequestMapping("/system/EmployeeWechat")
public class EmployeeWechatController extends BaseController
{
    @Autowired
    private IEmployeeWechatService employeeWechatService;

    /**
     * 查询月度推送企业微信人员管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:EmployeeWechat:list')")
    @GetMapping("/list")
    public TableDataInfo list(EmployeeWechat employeeWechat)
    {
        startPage();
        List<EmployeeWechat> list = employeeWechatService.selectEmployeeWechatList(employeeWechat);
        return getDataTable(list);
    }

    /**
     * 导出月度推送企业微信人员管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:EmployeeWechat:export')")
    @Log(title = "月度推送企业微信人员管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(EmployeeWechat employeeWechat)
    {
        List<EmployeeWechat> list = employeeWechatService.selectEmployeeWechatList(employeeWechat);
        ExcelUtil<EmployeeWechat> util = new ExcelUtil<EmployeeWechat>(EmployeeWechat.class);
        return util.exportExcel(list, "EmployeeWechat");
    }

    /**
     * 获取月度推送企业微信人员管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:EmployeeWechat:query')")
    @GetMapping(value = "/{userid}")
    public AjaxResult getInfo(@PathVariable("userid") String userid)
    {
        return AjaxResult.success(employeeWechatService.selectEmployeeWechatById(userid));
    }

    /**
     * 新增月度推送企业微信人员管理
     */
    @PreAuthorize("@ss.hasPermi('system:EmployeeWechat:add')")
    @Log(title = "月度推送企业微信人员管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EmployeeWechat employeeWechat)
    {
        return toAjax(employeeWechatService.insertEmployeeWechat(employeeWechat));
    }

    /**
     * 修改月度推送企业微信人员管理
     */
    @PreAuthorize("@ss.hasPermi('system:EmployeeWechat:edit')")
    @Log(title = "月度推送企业微信人员管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EmployeeWechat employeeWechat)
    {
        return toAjax(employeeWechatService.updateEmployeeWechat(employeeWechat));
    }

    /**
     * 删除月度推送企业微信人员管理
     */
    @PreAuthorize("@ss.hasPermi('system:EmployeeWechat:remove')")
    @Log(title = "月度推送企业微信人员管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{userids}")
    public AjaxResult remove(@PathVariable String[] userids)
    {
        return toAjax(employeeWechatService.deleteEmployeeWechatByIds(userids));
    }
}
